<?php
class UsersController extends AppController {

	var $name = 'Users';
    var $helpers = array('Javascript');

    function beforeFilter(){
        parent::beforeFilter();
        $this->Auth->allow('about','terms','privacy','copyright','help');
    }

    /**
     * Home login page user
     */
    function index(){
        $this->layout = 'admin';
    }

    function login(){
        $this->layout = 'login';
    }

    function logout(){
        $this->Session->setFlash('Logout sucessfully!');
        $this->redirect($this->Auth->logout());
    }

    /**
     * About page
     * usage in /users/about.ctp
     */
    function about(){
        $this->Post = ClassRegistry::init('Post');
        $this->set('randomPosts',$this->Post->getRandomPost());
    }

    /**
     * Terms
     */
    function terms(){
        $this->Post = ClassRegistry::init('Post');        
        $this->set('randomPosts',$this->Post->getRandomPost());
     }

     /**
      * Privacy
      */
     function privacy(){
        $this->Post = ClassRegistry::init('Post');
        $this->set('randomPosts',$this->Post->getRandomPost());
     }

     /**
      * Copyright
      */
     function copyright(){
        $this->Post = ClassRegistry::init('Post');
        $this->set('randomPosts',$this->Post->getRandomPost());
     }

     /**
      * Copyright
      */
     function help(){
        $this->Post = ClassRegistry::init('Post');
        $this->set('randomPosts',$this->Post->getRandomPost());
     }
     
}
?>